package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MyColorBean;
import flc.ast.bean.MyFrameBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class IndicatorAdapter extends StkProviderMultiAdapter<MyFrameBean> {

    public IndicatorAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(40));
        addItemProvider(new IndicatorProvider());
    }

    private int selPosition;

    public void setSelPosition(int selPosition) {
        this.selPosition = selPosition;
    }

    private class IndicatorProvider extends BaseItemProvider<MyFrameBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_indicator;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MyFrameBean bean) {
            if (baseViewHolder.getBindingAdapterPosition()==selPosition) {
                baseViewHolder.setImageResource(R.id.ivIndicatorItemImg,R.drawable.xz1);
            } else {
                baseViewHolder.setImageResource(R.id.ivIndicatorItemImg,R.drawable.shape_indicator);
            }
        }
    }
}
